#include <57header.h>

pthread_mutex_t lock1;
pthread_mutex_t lock2;

void *func(void  *p){

    pthread_mutex_lock(&lock2);
    sleep(1);
    pthread_mutex_lock(&lock1);

    printf("i am son_thread \n");

    pthread_mutex_unlock(&lock1);
    pthread_mutex_unlock(&lock2);
    return NULL;
}
int main(int argc,char*argv[])
{

    pthread_mutex_init(&lock1, NULL);
    pthread_mutex_init(&lock2, NULL);

    pthread_t son_id;
    pthread_create(&son_id, NULL, func, NULL);

    pthread_mutex_lock(&lock1);
    sleep(1);
    pthread_mutex_lock(&lock2);
    
    printf("i am main \n");

    pthread_mutex_unlock(&lock2);
    pthread_mutex_unlock(&lock1);

    pthread_join(son_id, NULL);
    return 0;
}

